<html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui" xmlns:ui="http://java.sun.com/jsf/facelets">
<h:body>
	<h:panelGrid columns="3" id="bookdlgpanel">

		<h:outputLabel value="New book's name:  " />
		<p:inputText id="bookName" required="true" label="Name: " value="#{booksBean.name}" validator="#{booksBean.validateBookName}" />
		<p:message for="bookName" id="bookNameemsg" display="text" />
		
		<h:outputLabel value="Author:  " />
		<p:autoComplete id="acSimple" value="#{booksBean.authortxt}" required="true" completeMethod="#{booksBean.completeAuthors}" 
		validator="#{booksBean.validateBookAuthor}" />
		<p:message for="acSimple" id="acSimplemsg" display="text" />
		
		<h:outputLabel value="Genres:  " />
		<p:autoComplete id="bookGenres" value="#{booksBean.selectedTexts}" required="true" completeMethod="#{booksBean.completeGenres}"
		 multiple="true"/>
		<p:message for="bookGenres" id="bookGenresmsg" display="text" />
		  
		<h:outputLabel value="Language:  " />
		<p:autoComplete id="bookLanguage" value="#{booksBean.languagetxt}" required="true" completeMethod="#{booksBean.completeLanguage}"
		validator="#{booksBean.validateBookLanguage}"/>  
		<p:message for="bookLanguage" id="bookLanguagemsg" display="text" />
		
		<h:outputLabel value="Publisher:  " />
		<p:autoComplete id="bookPublisher" value="#{booksBean.publishertxt}" required="true" completeMethod="#{booksBean.completePublisher}"
		validator="#{booksBean.validateBookPublisher}"/>  
		<p:message for="bookPublisher" id="bookPublishermsg" display="text" />
		
		<h:outputLabel value="Published on:   " />
		<p:calendar  value="#{booksBean.date}" id="date" effect="explode" navigator="true" />
		<p:message for="date" id="datemsg" display="text" />
		
		<h:outputLabel value="Edition:  " />
		<p:inputText  id="bookEdition" required="false" label="Edition: " value="#{booksBean.edition}" />
		<p:message for="bookEdition" id="bookEditionmsg" display="text" />
		
		
		<h:outputLabel value="Pages count:  " />
		<p:inputText id="bookPages" required="true" label="Count: " value="#{booksBean.pages}" 
		validator="#{booksBean.validateBookPagesCount}"/>
		<p:message for="bookPages" id="bookPagesmsg" display="text" />
		
		<h:outputLabel value="ISBN:  " />
		<p:inputText id="bookISBN" required="true" label="ISBN: " value="#{booksBean.isbn}" 
		validator="#{booksBean.validateBookISBN}"/>
		<p:message for="bookISBN" id="bookISBNmsg" display="text" />
		
		
		<h:outputLabel value="Summary:  " />
		<p:inputTextarea id="bookSummary" rows="5" cols="50" counter="counter" maxlength="1024" counterTemplate="{0} characters remaining."
			autoResize="false" value="#{booksBean.summary}" />
		<p:message for="bookSummary" id="bookSummarymsg" display="text" />
		
		
		<h:outputLabel value="  " />
		<h:outputText id="counter" />

		<f:facet name="footer">
			<p:commandButton value="Create" update="bookdlgpanel" action="#{booksBean.saveNewBook}"  />
		</f:facet>

	</h:panelGrid>
</h:body>
</html>